﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Fastyou.WCF.ServiceLib;
using System.ServiceModel.Description;
using Fastyou.WCF.Contracts;

namespace Fastyou.WCF.Host.Consoles
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                ServiceHost helloHost = new ServiceHost(typeof(Hello));
                helloHost.Opened += delegate
                {
                    Console.WriteLine("服务已经启动1！");

                };
                helloHost.Open();
                ////helloHost.Close();

                //ServiceHost reply = new ServiceHost(typeof(RequestReply));
                //reply.Opened += delegate
                //{
                //    Console.WriteLine("服务已经启动2！");

                //};
                

                //ServiceHost isoneway = new ServiceHost(typeof(IsOneWay));
                //isoneway.Opened += delegate
                //{
                //    Console.WriteLine("服务已经启动isoneway！");

                //};

                //ServiceHost duplex = new ServiceHost(typeof(Duplex));
                //duplex.Opened += delegate
                //{
                //    Console.WriteLine("服务已经启动duplex！");

                //};
                ////helloHost.Open();
                ////isoneway.Open();
                ////reply.Open();
                //duplex.Open();

                //ServiceHost fyservice = new ServiceHost(typeof(FYServiceContract));

                //fyservice.Opened += delegate
                //{
                //    Console.WriteLine("服务已经启动FY！");

                //};

                //fyservice.Open();

                //ServiceHost basicHttpSession = new ServiceHost(typeof(BasicHttpSessions));
                //basicHttpSession.Opened += delegate
                //{
                //    Console.WriteLine("服务 basicHttpSession 已经启动1！");

                //};
                //basicHttpSession.Open();

                //ServiceHost noneSession = new ServiceHost(typeof(NoneSession));
                //noneSession.Opened += delegate
                //{
                //    Console.WriteLine("服务 NoneSession 已经启动1！");

                //};
                //noneSession.Open();

                //ServiceHost faultc = new ServiceHost(typeof(FYFaultContracts));
                //faultc.Opened += delegate
                //{
                //    Console.WriteLine("服务 FYFaultContracts 已经启动1！");

                //};
                //faultc.Open();

                //ServiceHost callMode = new ServiceHost(typeof(CallMode));
                //callMode.Opened += delegate
                //{
                //    Console.WriteLine("服务 callMode 已经启动1！");

                //};
                //callMode.Open();

                //callMode = new ServiceHost(typeof(SingleMode));
                //callMode.Opened += delegate
                //{
                //    Console.WriteLine("服务 SingleMode 已经启动1！");

                //};
                //callMode.Open();

                //callMode = new ServiceHost(typeof(Fastyou.WCF.ServiceLib.SessionMode));
                //callMode.Opened += delegate
                //{
                //    Console.WriteLine("服务 SessionMode 已经启动1！");

                //};
                //callMode.Open();

                //ServiceHost conSing = new ServiceHost(typeof(ConSingleMode));
                //conSing.Opened += delegate
                //{
                //    Console.WriteLine("Con Single Mode start！");

                //};
                //conSing.Open();

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.Read();
        }
    }
}
